//
//  BaseNavigationController.m
//  BossBuy
//
//  Created by 吕飞俊 on 15/6/17.
//  Copyright (c) 2015年 润媛. All rights reserved.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [self innerPushViewController:viewController animated:animated];
}

-(void)innerPushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
//        self.interactivePopGestureRecognizer.enabled = NO;
    }
    [super pushViewController:viewController animated:animated];
}
// 导航栏设置，配置默认样式
+ (void)customizeInterface
{
    
    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
    // 设置title字体
    NSDictionary *textAttributes = @{
                                     NSForegroundColorAttributeName:[UIColor blackColor]
                                     };
    [navigationBarAppearance setTitleTextAttributes:textAttributes];
    //设置返回的颜色
    [navigationBarAppearance setTintColor:UIColor.blackColor];
    
    UIColor *dyColor = [UIColor whiteColor];
    [navigationBarAppearance setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    
    
//    [navigationBarAppearance setShadowImage:[UIImage hq_imageWithColor:[UIColor colorWithHexString:@"0xefeff0"]]];//0xe5e5e5
    [navigationBarAppearance setShadowImage:[UIImage new]];//移除底部横线
    [navigationBarAppearance setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"nav_back_white"]];
    [navigationBarAppearance setBackIndicatorImage:[UIImage imageNamed:@"nav_back_white"]];
    //隐藏返回按钮文字
    if ([UIDevice.currentDevice.systemVersion isEqualToString:@"11.0"]) {
       [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)forBarMetrics:UIBarMetricsDefault];
    }

}

//适配暗夜模式
//- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
//{
//    [super traitCollectionDidChange: previousTraitCollection];
//
//    if (@available(iOS 13.0, *)) {
//        [self.navigationBar setBackgroundImage:[UIImage hq_imageWithColor:[UIColor HqColor_White]] forBarMetrics:UIBarMetricsDefault];
//        [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor HqColorDark_333333]}];
//        [self.navigationBar setTintColor:[UIColor HqColorDark_333333]];
//    }
//}
//- (void)viewDidLoad
//{
//    [super viewDidLoad];
//    // Do any additional setup after loading the view.
//
//    if (@available(iOS 13.0, *)) {
//        UIColor *bgColor = [UIColor HqColor_White];
//
//        [self.navigationBar setBackgroundImage:[UIImage hq_imageWithColor:bgColor] forBarMetrics:UIBarMetricsDefault];
//        [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor HqColorDark_2a2c34]}];
//[self.navigationBar setTintColor:[UIColor HqColorDark_333333]];
//    }
//}
@end
